﻿using System;
using System.Reflection;

namespace Phoenix.Xna.Framework.Serialization.Markup.Fields
{
    /// <summary>
    /// Defines the intermediary markup field object definition.
    /// </summary>
    internal interface IMarkupField : IMarkupElement
    {
        /// <summary>
        /// Gets or sets the name of the field.
        /// </summary>
        string Name { get; set; }

        /// <summary>
        /// Gets or sets the System.Type of the defined object.
        /// </summary>
        Type ObjectType { get; set; }

        /// <summary>
        /// Gets a value indicating this field is not default, and should be serialized.
        /// </summary>
        bool ShouldPersist { get; }

        /// <summary>
        /// Extract the markup information from the FieldInfo for this field.
        /// </summary>
        /// <param name="field">The FieldInfo for this field.</param>
        /// <param name="value">The value of the field.</param>
        void ExtractMarkup(FieldInfo field, object value);

        /// <summary>
        /// Sets the value of MarkupField to the instance's field value.
        /// </summary>
        /// <param name="instance">The instance to set the field on.</param>
        void SetValue(object instance);
    }
}
